#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
//	system("start https://www.lanqiao.cn/problems/12048/learning/");

	int n, m, x;
	vector<int> cnt(3);

	cin >> n >> m;

	while (n--) {
		cin >> x;
		cnt[x]++;
	}

	vector<int> a;
	while (m--) {
		cin >> x;
		a.push_back(x);
	}

	for (int &t : a) {
		int k = t / 2;

		if (cnt[2] >= k) {
			t -= 2 * k;
			cnt[2] -= k;
		} else {
			t -= cnt[2];
			cnt[2] = 0;
		}

		if (t) {
			if (cnt[1] >= t) {
				t -= cnt[1];
				cnt[1] -= t;
			} else {
				t -= cnt[1];
				cnt[1] = 0;
			}
		}
	}

	if (cnt[1] || cnt[2])
		cout << "N";
	else
		cout << "Y";

	return 0;
}
